package com.intelligence.device.cloud;

import cn.hutool.core.util.ObjectUtil;
import com.alibaba.fastjson2.JSON;
import com.intelligence.entity.pojo.DeviceThreshold;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.data.redis.core.RedisTemplate;

import java.util.Collection;
import java.util.List;
import java.util.Map;
import java.util.Set;

/**
 * @Author : RulerWood
 * @Data : 2024/5/29 - 14:09
 */
@SpringBootTest
public class Demo {


    @Autowired
    private RedisTemplate redisTemplate;

    @Test
    public void test() {
//        Map<Long, DeviceThreshold> entries = redisTemplate.opsForHash().entries("device-threshold");
////        if (ObjectUtil.isEmpty(entries)) {
//            List<DeviceThreshold> list = this.deviceThresholdService.list();
//            for (DeviceThreshold d : list) {
//                System.out.println(d.getDeviceid());
//            }
////        }
//        System.out.println("键");
//
//        Set<Long> integers = entries.keySet();
//        for (Long i :
//                integers) {
//            System.out.println(i);
//        }
//
//        System.out.println("hash中存放的值");
//        for (DeviceThreshold s : entries.values()) {
//            System.out.println(s);
//        }
        DeviceThreshold o = (DeviceThreshold) redisTemplate.opsForHash().get("device-threshold", 99L);
        System.out.println(o);

    }


}
